<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div>
    <el-form ref="form" :model="ts_files" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 编制文件 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="24">
            <el-form-item label="文件主题" prop="subject">
              <el-input v-model="ts_files.subject" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="编制人" prop="">
              {{ts_files.assign_userid}}
              <el-button @click="popTaskArrange('','assign_userid')" type="success" size="mini"><i class="fa fa-edit"></i>选择</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-button @click="companyFileWriteSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
    </el-form>
    <el-dialog :visible.sync="TaskArrangeVisible" append-to-body>
      <TaskArrange v-if="TaskArrangeVisible" ref="TaskArrange" :popparams="popparams"> </TaskArrange>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import TaskArrange from "@/views/mes/autooffice/TaskArrange";
  export default {
    name: 'CompanyFileWrite',
    components: {
      TaskArrange,
    },
    props: ['popparams'],
    data() {
      return {
        TaskArrangeVisible: false,
        TaskArrangeValue: null,
        TaskArrangeDesc: null,
        vueparams: this.getVUEParams(""),
        ts_files: {
          subject: null,
          assign_userid: null,
        },
        loading: false,
        rules: {}
      }
    },
    created() {},
    updated() {},
    mounted() {},
    methods: {
      companyFileWriteSubmit(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/mes/systemadmin/CompanyFileWrite/companyFileWriteSubmit?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.$router.replace("/redirect" + this.$route.fullPath);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
      popTaskArrange(desc, value) {
        this.TaskArrangeVisible = true;
        this.TaskArrangeDesc = desc;
        this.TaskArrangeValue = value;
      },
      closeTaskArrange(value, desc) {
        this.TaskArrangeVisible = false;
        this.$set(this.ts_files, this.TaskArrangeDesc, desc);
        this.$set(this.ts_files, this.TaskArrangeValue, value);
      },
    },
  }
</script>
